import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '学号',
    align:"center",
    dataIndex: 'code'
   },
   {
    title: '姓名',
    align:"center",
    dataIndex: 'name'
   },
   {
    title: '部门',
    align:"center",
    dataIndex: 'departmentId_dictText'
   },
   {
    title: '餐段',
    align:"center",
    dataIndex: 'mealName'
   },
   {
    title: '手机号',
    align:"center",
    dataIndex: 'parent1Phone'
   },
   {
    title: '支付金额',
    align:"center",
    dataIndex: 'mealsMoney'
   },

   {
    title: '支付状态',
    align:"center",
    dataIndex: 'status',
    customRender: ({ text }) => {
      return render.renderDict(text, 'meals_status');
    },
   },
   {
    title: '支付时间',
    align:"center",
    dataIndex: 'createTime'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
     {
      label: "支付时间",
      field: "createTime",
      component: 'RangePicker',
      componentProps: {
          //日期格式化
           format:'YYYY-MM-DD',
           valueFormat:'YYYY-MM-DD'
      },
      //colProps: {span: 6},
	},
	{
      label: "学号",
      field: 'code',
      component: 'Input',
      //colProps: {span: 6},
 	},
   {
    label: "姓名",
    field: 'name',
    component: 'Input',
    //colProps: {span: 6},
 },
 {
  label:"所属部门",
  component:"JSelectDept",
  field:"departmentId",
  componentProps:{
    checkStrictly:false,
    multiple:false
  }
},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '人员id',
    field: 'personId',
    component: 'Input',
  },
  {
    label: '商户订单',
    field: 'outTradeNo',
    component: 'Input',
  },
  {
    label: '支付金额',
    field: 'money',
    component: 'InputNumber',
  },
  {
    label: '餐段id',
    field: 'pubjectId',
    component: 'Input',
  },
  {
    label: '微信处理id',
    field: 'transactionId',
    component: 'Input',
  },
  {
    label: '支付状态',
    field: 'status',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:""
     },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

export const refundColumns: BasicColumn[] = [
  {
   title: '学号',
   align:"center",
   dataIndex: 'code'
  },
  {
   title: '姓名',
   align:"center",
   dataIndex: 'name'
  },
  {
   title: '部门',
   align:"center",
   dataIndex: 'departmentId_dictText'
  },
  {
   title: '餐段',
   align:"center",
   dataIndex: 'productId_dictText'
  },
  {
    title: '支付时间',
    align:"center",
    dataIndex: 'createTime'
   },
  {
   title: '支付金额',
   align:"center",
   dataIndex: 'money'
  },
  {
   title: '状态',
   align:"center",
   dataIndex: 'status',
   customRender: ({ text }) => {
     return render.renderDict(text, 'meals_status');
   },
  },
  {
   title: '总订单数',
   align:"center",
   dataIndex: 'cnt'
  },
  {
    title: '已就餐数',
    align:"center",
    dataIndex: 'normal'
   },
   {
    title: '已停餐数',
    align:"center",
    dataIndex: 'unsub'
   },
   {
    title: '退款金额',
    align:"center",
    dataIndex: 'refundMoney'
   }
];

//查询数据
export const searchRefundFormSchema: FormSchema[] = [
{
   label: "学号",
   field: 'code',
   component: 'Input',
   //colProps: {span: 6},
},
{
 label: "姓名",
 field: 'name',
 component: 'Input',
 //colProps: {span: 6},
},
{
label:"所属部门",
component:"JSelectDept",
field:"departmentId",
componentProps:{
 checkStrictly:false,
 multiple:false
}
},
{
  label: '退费状态',
  field: 'isRefund',
  component: 'Select',
  componentProps: {
    //开关大小，可选值：default small
    options: [
      { value: 1, label: '未退费' },
      { value: 3, label: '已退费' }
    ],
  },
}

];


export const sumMealsRefundColumns: BasicColumn[] = [
  {
   title: '餐段',
   align:"center",
   dataIndex: 'mealName'
  },
  {
    title: '有效开始时间',
    align:"center",
    dataIndex: 'beginDate'
   },
   {
    title: '有效结束时间',
    align:"center",
    dataIndex: 'endDate'
   },
  {
    title: '订购人数',
    align:"center",
    dataIndex: 'cnt'
   },
   {
    title: '总缴费金额',
    align:"center",
    dataIndex: 'money'
   },
   {
    title: '总订餐数',
    align:"center",
    dataIndex: 'ordercnt'
   },
   {
    title: '停餐数',
    align:"center",
    dataIndex: 'unsub'
   },
   {
    title: '待退费金额',
    align:"center",
    dataIndex: 'refundMoney'
   },
   {
    title: '已退费金额',
    align:"center",
    dataIndex: 'payamount'
   },
]

//查询数据
export const searchSumMealsRefundFormSchema: FormSchema[] = [
  {
    label: "就餐时间",
    field: "diningDay",
    component: 'RangePicker',
    componentProps: {
        //日期格式化
         format:'YYYY-MM-DD',
         valueFormat:'YYYY-MM-DD'
    },
  },
  ];
  
  export const mealsOrderColumns: BasicColumn[] = [
    {
     title: '学号',
     align:"center",
     dataIndex: 'code'
    },
    {
     title: '姓名',
     align:"center",
     dataIndex: 'name'
    },
    {
      title: '电话',
      align:"center",
      dataIndex: 'parent1Phone'
     },
    {
     title: '部门',
     align:"center",
     dataIndex: 'departmentId_dictText'
    },
    {
      title: '支付时间',
      align:"center",
      dataIndex: 'createTime'
     },
    {
     title: '支付金额',
     align:"center",
     dataIndex: 'money'
    },
    {
     title: '状态',
     align:"center",
     dataIndex: 'status',
     customRender: ({ text }) => {
       return render.renderDict(text, 'meals_status');
     },
    },
    {
      title: '微信商户订单',
      align:"center",
      width:280,
      dataIndex: 'transactionId'
     }
  ];
  
  export const searchOrderFormSchema: FormSchema[] = [
    {
     label: "支付时间",
     field: "createTime",
     component: 'RangePicker',
     componentProps: {
         //日期格式化
          format:'YYYY-MM-DD',
          valueFormat:'YYYY-MM-DD'
     },
     //colProps: {span: 6},
 },
 {
     label: "学号",
     field: 'code',
     component: 'Input',
     //colProps: {span: 6},
  },
  {
   label: "姓名",
   field: 'name',
   component: 'Input',
   //colProps: {span: 6},
},
{
 label:"所属部门",
 component:"JSelectDept",
 field:"departmentId",
 componentProps:{
   checkStrictly:false,
   multiple:false
 }
},
{
  label: '支付状态',
  field: 'status',
  component: 'Select',
  componentProps: {
    //开关大小，可选值：default small
    options: [
      { value: 1, label: '已支付' },
      { value: 2, label: '支付失败'},
      { value: 3, label: '已退款' }
    ],
  },
}

];

  export const mealsOrderDetailColumns: BasicColumn[] = [
    {
     title: '餐段',
     align:"center",
     dataIndex: 'mealName'
    },
    {
     title: '金额',
     align:"center",
     dataIndex: 'money'
    }
    
  ];


// 高级查询数据
export const superQuerySchema = {
  personId: {title: '人员id',order: 1,view: 'text', type: 'string',},
  outTradeNo: {title: '商户订单',order: 2,view: 'text', type: 'string',},
  money: {title: '支付金额',order: 3,view: 'number', type: 'number',},
  pubjectId: {title: '餐段id',order: 4,view: 'text', type: 'string',},
  transactionId: {title: '微信处理id',order: 5,view: 'text', type: 'string',},
  status: {title: '支付状态',order: 6,view: 'number', type: 'number',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}